<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Position属性示例</title>
  <style>
    .container {
      position: relative;
      width: 300px;
      height: 200px;
      border: 1px solid black;
      margin: 50px;
    }

    .static {
      background-color: lightblue;
      padding: 10px;
      margin: 10px;
    }

    .relative {
      position: relative;
      top: 20px;
      left: 20px;
      background-color: lightgreen;
      padding: 10px;
      margin: 10px;
    }

    .absolute {
      position: absolute;
      top: 20px;
      left: 20px;
      background-color: lightcoral;
      padding: 10px;
      margin: 10px;
    }

    .fixed {
      position: fixed;
      top: 20px;
      right: 20px;
      background-color: lightgoldenrodyellow;
      padding: 10px;
      margin: 10px;
    }

    .sticky {
      position: sticky;
      top: 20px;
      background-color: lightpink;
      padding: 10px;
      margin: 10px;
    }
  </style>
</head>

<body>
  <div class="static">Static Element</div>
  <div class="container">
    <div class="relative">Relative Element</div>
    <div class="absolute">Absolute Element</div>
  </div>
  <div class="fixed">Fixed Element</div>
  <div class="sticky">Sticky Element</div>
</body>

</html>